;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;compile-window.lisp
;;
;;
;;  copyright © 1987-89 Apple Computer
;;
;;  This file adds a menu-item to the Eval menu.  This menu-item compiles the
;;  the file of the top Fred window.
;;
;;  Before compiling the file, it saves the window.
;;
;;  It also prompts the user for the name of the output file.

(defobfun (compile-window-file *fred-window*) ()
  (window-save)
  (let ((filename (window-filename)))
    (eval-enqueue
     `(compile-file ,filename
                    :verbose t
                    :output-file (choose-new-file-dialog
                                  :prompt "Save Compiled File AsÉ"
                                  :pathname
                                  (concatenate 'string
                                               (pathname-directory ,filename)
                                               (pathname-name ,filename)
                                               ".fasl"))))))

(ask *eval-menu*
  (add-menu-items (oneof *menu-item* :menu-item-title "-")
                  (oneof *window-menu-item*
                         :menu-item-title "Compile Top Window"
                         :menu-item-action 'compile-window-file)))